//
// Created by Felix on 24-4-28.
//

#ifndef GAZE_USERCREATEDTOVALIDATE_HPP
#define GAZE_USERCREATEDTOVALIDATE_HPP

#include "service/UserService.hpp"

class UserCreateDtoValidate {
public:
    static bool validateUniqueUsername(
            UserService &iUserService,
            const oatpp::Object<UserCreateDto> &dto
    ) {
        if (dto->username->empty()) return false;
        auto user = iUserService.getUserByUsername(dto->username);
        if (user) return false;
        return true;
    }

    static bool validateRequirePassword(
            const oatpp::Object<UserCreateDto> &dto
    ) {
        if (dto->password->empty()) return false;
        return true;
    }
};

#endif //GAZE_USERCREATEDTOVALIDATE_HPP
